iOS Drawing: Practical UIKit Solutions (Jason Arnold's Library) by Erica Sadun

iOS Drawing: Practical UIKit Solutions (Jason Arnold's Library) by Erica Sadun

Author:Erica Sadun
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2014-03-14T16:00:00+00:00


// Offset by size

CGSize size =

[[string substringWithRange: NSMakeRange(i, 1)]

sizeWithAttributes:@{NSFontAttributeName:font}];

OffsetPath(path, CGSizeMake(-size.width, 0));

}

// Clean up

free(glyphs); CFRelease(fontRef);

// Return the path to the UIKit coordinate system

MirrorPathVertically(path);

return path;

}

* * *

Adding Dashes

UIKit makes it easy to add dashes to a Bezier path. For example, you might add a simple repeating pattern, like this:

Click here to view code image

CGFloat dashes[] = {6, 2};

[path setLineDash:dashes count:2 phase:0];

The array specifies, in points, the on/off patterns used when drawing a stroke. This example draws lines of 6 points followed by spaces of 2 points. Your dash patterns will naturally vary by the scale of the drawing context and any compression used by the view. That said, there are many ways to approach dashes. Table 4-1 showcases some basic options.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.